
# import PyQt5
from PySide6.QtGui import QIcon
from PySide6.QtWidgets import QMessageBox


@staticmethod
def info(icon: QMessageBox.Icon, title: str, message: str, yesText="确定"):
    """信息对话框"""
    msg = QMessageBox()
    msg.setIcon(icon)
    msg.setWindowTitle(title)
    msg.setWindowIcon(QIcon('logo.png'))
    msg.setText(message)
    msg.setStandardButtons(QMessageBox.StandardButton.Yes)
    buttonYes = msg.button(QMessageBox.StandardButton.Yes)
    buttonYes.setText(yesText)
    return msg.exec()


@staticmethod
def confirm(icon: QMessageBox.Icon, title: str, message: str, yesText="确定", noText="取消"):
    """确认对话框"""
    msg = QMessageBox()
    msg.setIcon(icon)
    msg.setWindowTitle(title)
    msg.setWindowIcon(QIcon('logo.png'))
    msg.setText(message)
    msg.setStandardButtons(
        QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No)
    buttonYes = msg.button(QMessageBox.StandardButton.Yes)
    buttonNo = msg.button(QMessageBox.StandardButton.No)
    buttonYes.setText(yesText)
    buttonNo.setText(noText)
    return msg.exec()


@staticmethod
def confirmChoice(icon: QMessageBox.Icon, title: str, message: str, yesText="确定", yesToAllText="全部确定", noText="取消", ):
    """确认三种条件对话框"""
    msg = QMessageBox()
    msg.setIcon(icon)
    msg.setWindowTitle(title)
    msg.setWindowIcon(QIcon('logo.png'))
    msg.setText(message)
    msg.setStandardButtons(
        QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.YesToAll | QMessageBox.StandardButton.No)
    buttonYes = msg.button(QMessageBox.StandardButton.Yes)
    buttonYesToAll = msg.button(QMessageBox.StandardButton.YesToAll)
    buttonNo = msg.button(QMessageBox.StandardButton.No)
    buttonYes.setText(yesText)
    buttonYesToAll.setText(yesToAllText)
    buttonNo.setText(noText)
    return msg.exec()
